package com.md.api.controller;

import com.github.binarywang.wxpay.bean.request.WxPayOrderQueryRequest;
import com.github.binarywang.wxpay.bean.request.WxPayRefundQueryRequest;
import com.github.binarywang.wxpay.bean.result.WxPayOrderQueryResult;
import com.github.binarywang.wxpay.bean.result.WxPayRefundQueryResult;
import com.github.binarywang.wxpay.service.WxPayService;
import com.md.api.annotation.NoRepeatSubmit;
import com.md.api.common.utils.StringUtils;
import com.md.api.entity.HttpResult;
import com.md.api.entity.SiteEvaluate;
import com.md.api.entity.SiteInfo;
import com.md.api.entity.dto.ComposeCommitDto;
import com.md.api.entity.dto.ComposeQueryDto;
import com.md.api.entity.enums.OrderType;
import com.md.api.service.OrderService;
import com.md.api.service.RechargeService;
import com.md.api.service.ShoppingCartService;
import com.md.api.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Slf4j
@RequestMapping("/site")
@RestController
public class SiteController {

	@Autowired
	SiteService siteService;



	@RequestMapping("/page")
	@ResponseBody
	public HttpResult page(HttpServletRequest request,@RequestBody ComposeQueryDto qto) {

		return siteService.page(qto);
	}

	@RequestMapping("/detail")
	@ResponseBody
	public HttpResult detail(HttpServletRequest request,@RequestBody ComposeQueryDto info) {

		return siteService.detail(info);
	}


	@RequestMapping("/serviceContentPage")
	@ResponseBody
	public HttpResult serviceContentPage(HttpServletRequest request,@RequestBody ComposeQueryDto qto) {

		return siteService.serviceContentPage(qto);
	}



	@RequestMapping("/evaluatePage")
	@ResponseBody
	public HttpResult evaluatePage(HttpServletRequest request,@RequestBody ComposeQueryDto qto) {

		return siteService.evaluatePage(qto);
	}


	@RequestMapping("/evaluate")
	@ResponseBody
	public HttpResult evaluate(HttpServletRequest request,@RequestBody SiteEvaluate evaluate) {

		if (StringUtils.isEmpty(evaluate.getSiteId())||StringUtils.isEmpty(evaluate.getMsg())||null==evaluate.getStarNum()){
			return HttpResult.PARAM_ERROR;
		}
		return siteService.evaluate(request,evaluate);
	}
}
